home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / version / verdll / verinfo1.frm < prev    next >
Text File  |  1994-10-16  |  7KB  |  275 lines

  1. VERSION 2.00
  2. Begin Form verinfo1 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "VerInfo Demo"
  5.    Height          =   4980
  6.    Icon            =   VERINFO1.FRX:0000
  7.    Left            =   2280
  8.    LinkMode        =   1  'Source
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   17.875
  11.    ScaleMode       =   4  'Character
  12.    ScaleWidth      =   32.125
  13.    Top             =   1815
  14.    Width           =   3975
  15.    Begin DriveListBox Drive1 
  16.       Height          =   288
  17.       Left            =   1836
  18.       TabIndex        =   7
  19.       Top             =   3792
  20.       Width           =   1908
  21.    End
  22.    Begin DirListBox Dir1 
  23.       Height          =   1884
  24.       Left            =   1830
  25.       TabIndex        =   5
  26.       Top             =   1428
  27.       Width           =   1896
  28.    End
  29.    Begin FileListBox File1 
  30.       Height          =   2955
  31.       Left            =   120
  32.       TabIndex        =   3
  33.       Top             =   984
  34.       Width           =   1575
  35.    End
  36.    Begin TextBox Text1 
  37.       Height          =   288
  38.       Left            =   1092
  39.       TabIndex        =   1
  40.       Text            =   "*.*"
  41.       Top             =   204
  42.       Width           =   2544
  43.    End
  44.    Begin Label Label1 
  45.       Caption         =   "Dri&ves:"
  46.       Height          =   216
  47.       Index           =   4
  48.       Left            =   1830
  49.       TabIndex        =   6
  50.       Top             =   3480
  51.       Width           =   660
  52.    End
  53.    Begin Label Label1 
  54.       Caption         =   "&Directories:"
  55.       Height          =   192
  56.       Index           =   3
  57.       Left            =   1830
  58.       TabIndex        =   4
  59.       Top             =   1104
  60.       Width           =   1236
  61.    End
  62.    Begin Label Label1 
  63.       Caption         =   "c:\"
  64.       Height          =   204
  65.       Index           =   2
  66.       Left            =   1830
  67.       TabIndex        =   8
  68.       Top             =   648
  69.       Width           =   1884
  70.    End
  71.    Begin Label Label1 
  72.       Caption         =   "&Files:"
  73.       Height          =   204
  74.       Index           =   0
  75.       Left            =   120
  76.       TabIndex        =   2
  77.       Top             =   648
  78.       Width           =   612
  79.    End
  80.    Begin Label Label1 
  81.       Caption         =   "File&Name:"
  82.       Height          =   204
  83.       Index           =   1
  84.       Left            =   120
  85.       TabIndex        =   0
  86.       Top             =   252
  87.       Width           =   936
  88.    End
  89.    Begin Menu AboutBox 
  90.       Caption         =   "&About"
  91.    End
  92.    Begin Menu EndProgram 
  93.       Caption         =   "&End"
  94.    End
  95. End
  96.  
  97. Sub AboutBox_Click ()
  98.     About2.Show
  99. End Sub
  100.  
  101. Sub Dir1_Change ()
  102. File1.Path = Dir1.Path
  103. Label1(2).Caption = File1.Path
  104. End Sub
  105.  
  106. Sub DisplayVerInfo ()
  107. Dim X As VS_VERSION
  108.  
  109.  
  110. '*** Get Version Info ****
  111. FileVer$ = "": ProdVer$ = "": FileFlags$ = ""
  112. FileOS$ = "": FileType$ = "": FileSubType$ = ""
  113. FileName$ = File1.List(File1.ListIndex)
  114. Directory$ = Label1(2).Caption
  115. FullFileName$ = Label1(2).Caption + "\" + FileName$
  116. BufSize& = GetFileVersionInfoSize(FullFileName$, dwHandle&)
  117. If BufSize& = 0 Then
  118. MsgBox "No Version Info available!"
  119. Exit Sub
  120. End If
  121. lpvData$ = Space$(BufSize&)
  122. r% = GetFileVersionInfo(FullFileName$, dwHandle&, BufSize&, lpvData$)
  123. hmemcpy X, ByVal lpvData$, Len(X)
  124.  
  125.  
  126. '**** Determine File Version number ****
  127. FileVer$ = LTrim$(Str$(HIWORD(X.dwFileVersionMS))) + "."
  128. FileVer$ = FileVer$ + LTrim$(Str$(LOWORD(X.dwFileVersionMS)))
  129.  
  130.  
  131. '**** Determine Product Version number ****
  132. ProdVer$ = LTrim$(Str$(HIWORD(X.dwFileVersionMS))) + "."
  133. ProdVer$ = ProdVer$ + LTrim$(Str$(LOWORD(X.dwProductVersionMS)))
  134.  
  135. '**** Determine Boolean attributes of File ****
  136. If X.dwFileFlags And VS_FF_DEBUG Then FileFlags$ = "DeBug"
  137. If X.dwFileFlags And VS_FF_PRERELEASE Then FileFlags$ = FileFlags$ + "PreRel"
  138. If X.dwFileFlags And VS_FF_PATCHED Then FileFlags$ = FileFlags$ + "Patched"
  139. If X.dwFileFlags And VS_FF_PRIVATEBUILD Then FileFlags$ = FileFlags$ + "Private"
  140. If X.dwFileFlags And VS_FF_INFOINFERRED Then FileFlags$ = FileFlags$ + "Info"
  141. If X.dwFileFlags And VS_FF_DEBUG Then FileFlags$ = FileFlags$ + "Special"
  142.  
  143.  
  144. If X.dwFileFlags And &HFFFFFF00 Then FileFlags$ = FileFlags$ + "Unknown"
  145.  
  146.  
  147. '**** Determine OS for which file was designed ****
  148. Select Case X.dwFileOS
  149.     Case VOS_DOS_WINDOWS16
  150.         FileOS$ = "DOS-Win16"
  151.     Case VOS_DOS_WINDOWS32
  152.         FileOS$ = "DO =Win32"
  153.     Case VOS_OS216_PM16
  154.         FileOS$ = "OS/2-16 PM-16"
  155.     Case VOS_OS232_PM32
  156.         FileOS$ = "OS/2-32 PM-32"
  157.     Case VOS_NT_WINDOWS32
  158.         FileOS$ = "NT-Win32"
  159.     Case Else
  160.         FileOS$ = "Unknown"
  161. End Select
  162.  
  163.  
  164.  
  165. '**** Determine Type and SubType of File ****
  166. Select Case X.dwFileType
  167.     Case VFT_APP
  168.         FileType$ = "App"
  169.     Case VFT_DLL
  170.         FileType$ = "DLL"
  171.     Case VFT_DRV
  172.         FileType$ = "Driver"
  173.         Select Case X.dwFileSubType
  174.             Case VFT2_DRV_PRINTER
  175.                 FileSubType$ = "Printer drv"
  176.             Case VFT2_DRV_KEYBOARD
  177.                 FileSubType$ = "Keyboard drv"
  178.             Case VFT2_DRV_LANGUAGE
  179.                 FileSubType$ = "Language drv"
  180.             Case VFT2_DRV_DISPLAY
  181.                 FileSubType$ = "Display drv"
  182.             Case VFT2_DRV_MOUSE
  183.                 FileSubType$ = "Mouse drv"
  184.             Case VFT2_DRV_NETWORK
  185.                 FileSubType$ = "Network drv"
  186.             Case VFT2_DRV_INSTALLABLE
  187.                 FileSubType$ = "Installable"
  188.             Case VFT2_DRV_SOUND
  189.                 FileSubType$ = "Sound drv"
  190.             Case VFT2_DRV_COMM
  191.                 FileSubType$ = "Comm drv"
  192.             Case VFT2_UNKNOWN
  193.                 FileSubType$ = "Unknown"
  194.         End Select
  195.  
  196.     Case VFT_FONT
  197.         FileType$ = "Font"
  198.         Select Case X.dwFileSubType
  199.             Case VFT_FONT_RASTER
  200.                 FileSubType$ = "Raster Font"
  201.             Case VFT_FONT_VECTOR
  202.                 FileSubType$ = "Vector Font"
  203.             Case VFT_FONT_TRUETYPE
  204.                 FileSubType$ = "TrueType Font"
  205.         End Select
  206.     Case VFT_VXD
  207.         FileType$ = "VxD"
  208.     Case VFT_STATIC_LIB
  209.         FileType$ = "Lib"
  210.     Case Else
  211.     FileType$ = "Unknown"
  212. End Select
  213.  
  214.  
  215. Verinfo2.Show 1
  216. End Sub
  217.  
  218. Sub Drive1_Change ()
  219.     Dir1.Path = Drive1.Drive
  220.     File1.Path = Dir1.Path
  221.     Label1(2).Caption = File1.Path
  222. End Sub
  223.  
  224. Sub EndProgram_Click ()
  225.     End
  226. End Sub
  227.  
  228. Sub File1_Click ()
  229.     Text1.Text = File1.List(File1.ListIndex)
  230. End Sub
  231.  
  232. Sub File1_DblClick ()
  233.     DisplayVerInfo
  234. End Sub
  235.  
  236. Sub File1_PathChange ()
  237.     Text1.Text = "*.*"
  238.     File1.Pattern = "*.*"
  239. End Sub
  240.  
  241. Sub Form_Load ()
  242.     Dim Buffer$
  243.     ' **** Set Default Dir to Windows System Subdirectory ****
  244.     Buffer$ = Space$(256)
  245.     r% = GetSystemDirectory(Buffer$, Len(Buffer$))
  246.     Dir1.Path = Buffer$
  247.     File1.Path = Buffer$
  248.     Drive1.Drive = Left$(Buffer$, 1)
  249.     About2.lbl_Title = "VER.DLL Demo"
  250.     About2.lbl_Version = "Version 10.15.94"
  251. End Sub
  252.  
  253. Function HIWORD (X As Long) As Integer
  254.     HIWORD = X \ &HFFFF&
  255. End Function
  256.  
  257. Function LOWORD (X As Long) As Integer
  258.     LOWORD = X And &HFFFF&
  259. End Function
  260.  
  261. Sub Text1_KeyPress (KeyAscii As Integer)
  262.     If KeyAscii = 13 Then
  263.         File1.Pattern = Text1.Text
  264.     KeyAscii = 0
  265.     If File1.ListCount = 1 Then DisplayVerInfo
  266.         If File1.ListCount = 0 Then
  267.             MsgBox "Invalid Filename"
  268.             File1.Pattern = "*.*"
  269.             Text1.Text = "*.*"
  270.         End If
  271.         File1.SetFocus
  272.     End If
  273. End Sub
  274.  
  275.